package com.liuzh.deviceinfo.sensors;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.MenuItem;
import androidx.appcompat.app.ActionBar;
import c.h.a.b0.n;
import c.h.a.h0.a;
import c.h.a.m0.i;
import c.h.a.m0.k;
import com.huawei.hms.jos.games.ranking.RankingConst;
import com.liuzh.deviceinfo.base.BaseActivity;
import java.util.Objects;

public class SensorDetailActivity extends BaseActivity {
    public boolean q = true;

    public void onBackPressed() {
        if (this.q) {
            i iVar = i.a;
            iVar = i.a;
            SharedPreferences sharedPreferences = i.b;
            if (sharedPreferences.getBoolean("can_show_rate_dialog", true) && sharedPreferences.getInt("enter_sensor_detail_count", 0) == 3) {
                this.q = false;
                new n(this).a();
                return;
            }
        }
        this.e.a();
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        ActionBar t = t();
        if (t != null) {
            t.n(true);
        }
        Intent intent = getIntent();
        String str = RankingConst.RANKING_JGW_NAME;
        CharSequence stringExtra = intent.getStringExtra(str);
        String str2 = "type";
        int intExtra = getIntent().getIntExtra(str2, 0);
        String str3 = "icon";
        int intExtra2 = getIntent().getIntExtra(str3, 0);
        a aVar = new a();
        Bundle bundle2 = new Bundle();
        bundle2.putString(str, stringExtra);
        bundle2.putInt(str2, intExtra);
        bundle2.putInt(str3, intExtra2);
        str = k.b(intExtra, this);
        if (!TextUtils.equals(str, getString(2131690514)) || TextUtils.isEmpty(stringExtra)) {
            stringExtra = str;
        }
        setTitle(stringExtra);
        if (bundle == null) {
            aVar.e0(bundle2);
            b.l.a.i iVar = (b.l.a.i) o();
            Objects.requireNonNull(iVar);
            b.l.a.a aVar2 = new b.l.a.a(iVar);
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(a.class.getSimpleName());
            stringBuilder.append(aVar.hashCode());
            aVar2.f(16908290, aVar, stringBuilder.toString(), 2);
            aVar2.j();
            i iVar2 = i.a;
            iVar2 = i.a;
            SharedPreferences sharedPreferences = i.b;
            String str4 = "enter_sensor_detail_count";
            int i = sharedPreferences.getInt(str4, 0);
            if (i < Integer.MAX_VALUE) {
                i++;
            }
            c.b.a.a.a.o(sharedPreferences, str4, i);
        }
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != 16908332) {
            return super.onOptionsItemSelected(menuItem);
        }
        onBackPressed();
        return true;
    }
}
